home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.3 KB | 62 lines | [TEXT/GEOL] |
- Item 4737032 9-Aug-90 09:46PDT
-
- From: KNEPPER Knepper, Christopher
-
- To: AUST0334 AUDev - CRIA, Canberra, ACT,IDV
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: Re: MemoryMgrProblem
-
- Martin,
-
- >Recently I have been experiencing a few run-time bugs with our MacApp
- >application. Various pictures were being deleted when memory was tight etc.
-
- I'd like to offer a different explanation to the one that you came up with
- involving MacApp's memory management. What I think is happening is this. The
- TPicture object loads a purgeable 'PICT' resource. This resource fits in the
- application heap just fine when heap space isn't tight, but it gets purged when
- heap space gets tight. This is actually a feature of the Macintosh Memory
- Manager and has nothing to do with MacApp's permanent/temporary memory.
-
- When you run your application in tight memory situations, the 'PICT' resource
- gets purged because the memory manager needs the space and notices that the
- 'PICT' resource is a purgeable block. After the Macintosh Memory Manager purges
- the block, the master pointer contains a NIL entry. When your application
- attempts to image the TPicture object, the TPicture.Draw method _tries_ to load
- the 'PICT' resource with a LoadResource call. If there isn't enough memory in
- the application heap space, the LoadResource call fails and TPicture.Draw
- (correctly) does nothing. Here's the code from MacApp 2.0:
-
- PROCEDURE TPicture.Draw(area: Rect); OVERRIDE;
-
- VAR
- oldState: SignedByte;
- theRect:Rect;
-
- BEGIN
- IF fDataHandle <> NIL THEN
- BEGIN
- IF fRsrcID <> kNoResource THEN
- LoadResource(Handle(fDataHandle));
- IF fDataHandle^ <> NIL THEN { If there's room for the picture… }
- BEGIN
- ...draws the picture...
- END;
- END;
- INHERITED Draw(area);
- END;
-
- So, what I suggest that you do is either:
-
- 1. make your 'PICT' resources smaller, or
- 2. increase your temporary reserve by adding a 'mem!' resource to your
- application.r file as described in the MacApp 2.0 General Reference (chapter
- 3). This increase the space used for noncode temporary requests. You may have
- to determine empirically how much space to add to the temporary reserve,
- although 2K should do (depending on the size of your largest picture).
-
- -Chris
-
-